package hflyeer.o2o.util;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 获取全路径
 * @author flyer
 *
 */
public class PathUtils {

	// 系统路径分割符
	private static final String separator = File.separator;
	
	// 日志
	private static final Logger logger = LoggerFactory.getLogger(PathUtils.class);
	/**
	 * 获取图片的基础路径
	 * @return
	 */
	public static String getImageBasePath() {
		String basePath = "";
		//根据不同系统存放到不同路径上
		String sysName = System.getProperty("os.name");
		if(sysName.toLowerCase().startsWith("win")) {
			basePath = "D:/images/";
		}else {
			basePath = "/home/flyer/Workspace/images/";
		}
		return basePath.replace("/", separator);
	}
	
	/**
	 * 根据shopId获取路径
	 * shop/shopId/
	 * @param long1
	 * @return
	 */
	public static String getShopImagePath(Long long1) {
		String path = "shop/"+long1+"/";
		logger.debug("getShopImagePath缩略图:"+path);
		return path.replace("/", separator);
	}
}
